package com.example.demo.zaqizabatest.jdkproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @ClassName LoggerHandler
 * @Author lys4134
 * @Date 2021/08/19 16:03:58
 * @Description LoggerHandler
 * @Version 1.0
 **/
public class LoggerHandler implements InvocationHandler {
    private Object target;

    public LoggerHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("start");
        Object invoke = method.invoke(target, args);
        System.out.println("end");
        return invoke;
    }
}
